import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel('学生各学期成绩表.xlsx',index_col=0)
data = df.agg('mean',numeric_only=True)
print(data)
plt.pie(data,labels=data.index,autopct='%.2f%%')
plt.rcParams['font.sans-serif'] = 'SimHei'
plt.title('各科平均成绩占比饼状图')
plt.show()